<template>
	<view>
		<component :is="isShowIndex" ref="myChildComponentOne"></component>
		<!-- <tab-bar-view :tabCode="'1'"></tab-bar-view> -->
	</view>
</template>

<script>
	import loadAnalysisThreeBuildOneFloor from "@/components/dormThreeBuildingOneFloor/loadAnalysis/index.vue"
	import loadAnalysisThreeBuildTwoFloor from "@/components/dormThreeBuildingTwoFloor/loadAnalysis/index.vue"
	import loadAnalysisThreeBuildThreeFloor from "@/components/dormThreeBuildingThreeFloor/loadAnalysis/index.vue"
	import loadAnalysisThreeBuildFourFloor from "@/components/dormThreeBuildingFourFloor/loadAnalysis/index.vue"
	import loadAnalysisThreeBuildFiveFloor from "@/components/dormThreeBuildingFiveFloor/loadAnalysis/index.vue"

	import loadAnalysisTwoBuildOneFloor from "@/components/dormTwoBuildingOneFloor/loadAnalysis/index.vue"
	import loadAnalysisTwoBuildTwoFloor from "@/components/dormTwoBuildingTwoFloor/loadAnalysis/index.vue"
	import loadAnalysisTwoBuildThreeFloor from "@/components/dormTwoBuildingThreeFloor/loadAnalysis/index.vue"
	import loadAnalysisTwoBuildFourFloor from "@/components/dormTwoBuildingFourFloor/loadAnalysis/index.vue"
	import loadAnalysisTwoBuildFiveFloor from "@/components/dormTwoBuildingFiveFloor/loadAnalysis/index.vue"

	import loadAnalysisOneBuildOneFloor from "@/components/dormOneBuildingOneFloor/loadAnalysis/index.vue"
	import loadAnalysisOneBuildTwoFloor from "@/components/dormOneBuildingTwoFloor/loadAnalysis/index.vue"
	import loadAnalysisOneBuildThreeFloor from "@/components/dormOneBuildingThreeFloor/loadAnalysis/index.vue"
	import loadAnalysisOneBuildFourFloor from "@/components/dormOneBuildingFourFloor/loadAnalysis/index.vue"
	import loadAnalysisOneBuildFiveFloor from "@/components/dormOneBuildingFiveFloor/loadAnalysis/index.vue"
	
	import loadAnalysisOneBuildEle from "@/components/electricianOneBuild/loadAnalysis/index.vue"
	import loadAnalysisTwoBuildEle from "@/components/electricianTwoBuild/loadAnalysis/index.vue"
	import loadAnalysisThreeBuildEle from "@/components/electricianThreeBuild/loadAnalysis/index.vue"
	export default {
		components: {
			loadAnalysisThreeBuildOneFloor,
			loadAnalysisThreeBuildTwoFloor,
			loadAnalysisThreeBuildThreeFloor,
			loadAnalysisThreeBuildFourFloor,
			loadAnalysisThreeBuildFiveFloor,
			loadAnalysisTwoBuildOneFloor,
			loadAnalysisTwoBuildTwoFloor,
			loadAnalysisTwoBuildThreeFloor,
			loadAnalysisTwoBuildFourFloor,
			loadAnalysisTwoBuildFiveFloor,
			loadAnalysisOneBuildOneFloor,
			loadAnalysisOneBuildTwoFloor,
			loadAnalysisOneBuildThreeFloor,
			loadAnalysisOneBuildFourFloor,
			loadAnalysisOneBuildFiveFloor,
			loadAnalysisOneBuildEle,
			loadAnalysisTwoBuildEle,
			loadAnalysisThreeBuildEle
		},
		data() {
			return {
				activeMenu: "",
				isShowIndex: "",
			};
		},
		onLoad(query) {
			this.activeMenu = query.activeMenu
		},
		onShow() {
			this.switchShowPage(this.activeMenu)

			// this.$refs.myChildComponentOne.setupTimer();
		},
		onReady() {
			// 隐藏导航栏
			uni.hideTabBar({});
		},
		onUnload() {
			this.$refs.myChildComponentOne.clearTimer();
		},
		methods: {
			switchShowPage(data) {
				const _this = this
				switch (data) {
					case '3-1':
						_this.isShowIndex = 'loadAnalysisThreeBuildOneFloor'
						break;
					case '3-2':
						_this.isShowIndex = 'loadAnalysisThreeBuildTwoFloor'
						break;
					case '3-3':
						_this.isShowIndex = 'loadAnalysisThreeBuildThreeFloor'
						break;
					case '3-4':
						_this.isShowIndex = 'loadAnalysisThreeBuildFourFloor'
						break;
					case '3-5':
						_this.isShowIndex = 'loadAnalysisThreeBuildFiveFloor'
						break;
					case '2-1':
						_this.isShowIndex = 'loadAnalysisTwoBuildOneFloor'
						break;
					case '2-2':
						_this.isShowIndex = 'loadAnalysisTwoBuildTwoFloor'
						break;
					case '2-3':
						_this.isShowIndex = 'loadAnalysisTwoBuildThreeFloor'
						break;
					case '2-4':
						_this.isShowIndex = 'loadAnalysisTwoBuildFourFloor'
						break;
					case '2-5':
						_this.isShowIndex = 'loadAnalysisTwoBuildFiveFloor'
						break;
					case '1-1':
						_this.isShowIndex = 'loadAnalysisOneBuildOneFloor'
						break;
					case '1-2':
						_this.isShowIndex = 'loadAnalysisOneBuildTwoFloor'
						break;
					case '1-3':
						_this.isShowIndex = 'loadAnalysisOneBuildThreeFloor'
						break;
					case '1-4':
						_this.isShowIndex = 'loadAnalysisOneBuildFourFloor'
						break;
					case '1-5':
						_this.isShowIndex = 'loadAnalysisOneBuildFiveFloor'
						break;
					case 'dg-1':
						_this.isShowIndex = 'loadAnalysisOneBuildEle'
						break;
					case 'dg-2':
						_this.isShowIndex = 'loadAnalysisTwoBuildEle'
						break;
					case 'dg-3':
						_this.isShowIndex = 'loadAnalysisThreeBuildEle'
						break;
					default:
						// 如果 expression 不匹配任何 case 值，则执行 default 子句中的代码块  
						break;
				}
			},

			goPage(url) {
				uni.navigateTo({
					url
				});
			},
		},
	};
</script>

<style lang="scss" scoped>
	page {
		background-color: #f5f5f5;
	}
</style>